
<style>
    .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}
</style>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">

        <div class="layui-form layuimini-form" >

            <input type="hidden" name="uid" th:value="${user.uid}">

            <div class="layui-form-item">
                <label class="layui-form-label required">管理账号</label>
                <div class="layui-input-block">
                    <input type="text" name="uname" th:value="${user.uname}" lay-verify="required" lay-reqtext="管理账号不能为空" placeholder="请输入管理账号" class="layui-input" readonly>
                    <tip>填写自己管理账号的名称。</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">手机</label>
                <div class="layui-input-block">
                    <input type="number" name="phone" th:value="${user.phone}" lay-verify="required" lay-reqtext="手机不能为空" placeholder="请输入手机"  value="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-block">
                    <input type="email" name="email" th:value="${user.email}"  placeholder="请输入邮箱"  value="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <textarea name="remark" th:text="${user.remark}" class="layui-textarea" placeholder="请输入备注信息"></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['jquery','form','miniPage'], function () {

        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer,
            miniPage = layui.miniPage;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //监听提交
        form.on('submit(saveBtn)', function (data) {

            var data = JSON.stringify(data.field);

            $.ajax({
                type:"post",
                dataType: "json",
                url:"/admin/user/updateUserSetting",
                contentType: "application/json;charset=UTF-8",//指定消息请求类型
                data: data,
                success:function (data){
                    if (data.code == 0){
                        layer.msg(data.msg, {icon:1,time:1000},function(){
                            parent.location.reload();
                        });
                    }else {
                        layer.msg("更新用户信息失败");
                    }

                }

            })
            return false;
        });

    });
</script>